package com.demo.study.structural.d01_adapter;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;

/**
 * adapter 适配器模式
 *
 * @author Baymax
 * @since 2021/1/17
 */
public class AdapterMain {
    public static void main(String[] args) throws Exception {
        FileInputStream inputStream = new FileInputStream("D:/test.txt");
        // InputStreamReader 就是连接FileInputStream和BufferedReader的适配器
        InputStreamReader reader = new InputStreamReader(inputStream);
        BufferedReader br = new BufferedReader(reader);
        System.out.println(br.readLine());
        br.close();
        reader.close();
    }
}
